Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

343
Views
¿Por qué recibo el error "Margen insuficiente" al realizar un pedido de futuros de la API de Binance?
import { createRequire, runMain } from "module"; const require = createRequire(import.meta.url); const Binance = require("node-binance-api"); const binance = new Binance().options({ APIKEY: "<API-KEY>", APISECRET: "<API-SECRET>", useServerTime: true, }); async function Trade(interval, { symbol, EnterAt, Type }) { try { if ((interval == "1h" || interval == "4h") & (Type == "SHORT")) { let response = await binance.futuresBalance(); let pair = response.filter((el) => el.asset == "USDT"); const leverage = 6; let quantity = Math.round( ((parseFloat(pair[0].availableBalance) * leverage) / EnterAt).toFixed(2) ); let takeProfit = EnterAt - (EnterAt * 0.6) / 100; let stopMarket = EnterAt + (EnterAt * 1.1) / 100; // Adjust leverage let adjustLeverage = await binance.futuresLeverage(symbol, leverage); // Futures Market Sell let short = await binance.futuresMarketSell(symbol, quantity); // Set TAKE PROFIT let TP = await binance.futuresOrder("BUY", symbol, quantity, false, { type: "TAKE_PROFIT_MARKET", stopPrice: takeProfit.toFixed(2), closePosition: true, }); // Set STOP LOSS let SL = await binance.futuresOrder("BUY", symbol, quantity, false, { type: "STOP_MARKET", workingType: "MARK_PRICE", stopPrice: stopMarket.toFixed(2), closePosition: true, }); console.log("SHORT: ", short); console.log("TP: ", TP); console.log("SL: ", SL); } } catch (error) { console.log(error.message); } } function wrapUpTrade(interval, { symbol, EnterAt }) { binance.useServerTime(() => Trade(interval, { symbol: symbol, EnterAt: EnterAt }) ); } // wrapUpTrade("1h", { symbol: "XRPUSDT", shortAt: 0.774 }); export { wrapUpTrade };

Este código es solo para futuros Market Sell (vender en corto). ¿Por qué recibo un error de Margen insuficiente al realizar un pedido de monedas con un precio de $ 4.5 y tengo $ 2.9 en mi billetera? Al apalancar (6x) tendré (6 * $ 2.9 = $ 17.4) que es mayor que $ 4.5, pero recibo el error de Error insuficiente. La función Trade toma algunos argumentos:

 Interval: "4h" or "1h" symbol: "PAIR/(USDT)" // BTCUSDT, ETHUSDT EnterAt: It is used to calculate Stoploss and TakeProfit. The type is int. Type: "SHORT", means futuresSell
about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!